﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Windows.File
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System.Runtime.CompilerServices;
using UnityEngine.Bindings;

#nullable disable
namespace UnityEngine.Windows
{
  /// <summary>
  ///   <para>Provides static methods for file operations.</para>
  /// </summary>
  public static class File
  {
    /// <summary>
    ///   <para>Opens a binary file, reads the contents of the file into a byte array, and then closes the file.</para>
    /// </summary>
    /// <param name="path">The file to open for reading.</param>
    [NativeHeader("PlatformDependent/MetroPlayer/Bindings/WindowsFileBindings.h")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern byte[] ReadAllBytes(string path);

    /// <summary>
    ///   <para>Creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists, it is overwritten.</para>
    /// </summary>
    /// <param name="path">The file to write to.</param>
    /// <param name="bytes">The bytes to write to the file.</param>
    [NativeHeader("PlatformDependent/MetroPlayer/Bindings/WindowsFileBindings.h")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern void WriteAllBytes(string path, [Unmarshalled] byte[] bytes);

    /// <summary>
    ///   <para>Determines whether the specified file exists.</para>
    /// </summary>
    /// <param name="path">The file to check.</param>
    [NativeHeader("PlatformDependent/MetroPlayer/Bindings/WindowsFileBindings.h")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern bool Exists(string path);

    /// <summary>
    ///   <para>Deletes the specified file.</para>
    /// </summary>
    /// <param name="path">The name of the file to be deleted.</param>
    [NativeHeader("PlatformDependent/MetroPlayer/Bindings/WindowsFileBindings.h")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern void Delete(string path);
  }
}
